<?php  if (!defined('PATH_HD')) exit('No direct script access allowed');

class IndexControl extends Control{
    
     function __auto() {
        $template = __ROOT__ . '/template/' . C('tpl_style');
        $this->assign("template", $template);
    }
    
    function index(){
        $sql="select value from ".C('DB_PREFIX')."config where cid=5";
        $result=M()->query($sql);
        if($result[0]['value']==0){
            echo "<h1>网站维护中，请一个小时后访问</h1>";
            return false;
        }
        $this->display();
    }

    function cat(){

        $cid=$_GET['cid'];
        $sql="select cattpl,catname from ".C('DB_PREFIX')."category where cid=$cid";
        $result=M()->query($sql);
        $sql1="select value from ".C('DB_PREFIX')."config where cid=4";
        $style=M()->query($sql1);
        $tpl=PATH_ROOT.'/template/'.$style[0]['value'].'/'.$result[0]['cattpl'];
        // p($tpl);die;
        $sql2="select title,addtime from ".C('DB_PREFIX')."arc";
        $data=M()->query($sql2);
        $this->assign('data',$data);
        $this->assign('result',$result);
        $this->display($tpl);

    }

    function arc(){

        $cid=$_GET['cid'];
        $sql="select arctpl,catname from ".C('DB_PREFIX')."category where cid=$cid";
        $result=M()->query($sql);
        $sql1="select value from ".C('DB_PREFIX')."config where cid=4";
        $style=M()->query($sql1);
        $tpl=PATH_ROOT.'/template/'.$style[0]['value'].'/'.$result[0]['arctpl'];
        $sql2="select title,addtime from ".C("DB_PREFIX")."arc";
        $this->assign('result',$result);
        $this->display($tpl);

    }

    function login(){
    	$this->display();
    }

    function regs(){
    	$this->display();
    }

    function product(){
    	$this->display();
    }

    function download(){
        $this->display();
    }

    function case1(){
        $this->display();
    }

    function job(){
        $this->display();
    }

    function case4(){
        $this->display();
    }

    function news1(){
        $this->display();
    }

}
?>